use clap::Parser;
use std::path::PathBuf;

#[derive(Parser,Debug)]
#[command(version,about,long_about=None)]
pub struct  Args{
    #[arg(short,long)]
    pub name:String,
    #[arg(short,long,default_value_t=1)]
    pub count:u8,
}


pub mod quick_start{
    use clap::{Parser,Subcommand};
    use std::path::PathBuf;

    #[derive(Parser)]
    #[command(version,about,long_about=None)]
    struct Cli{
        name:Option<String>,
        // 自定义参数配置
        #[arg(short,long,value_name="FILE")]
        config:Option<PathBuf>,
        #[arg(short,long,action=clap::ArgAction::Count)]
        debug:u8,
        #[command(subcommand)]
        command:Option<Commands>,

    }
    #[derive(Subcommand)]
    enum Commands{
        Test{
            #[arg(short,long)]
            list:bool
        }
    }

    pub fn quick_run(){
        let cli = Cli::parse();

        // 查看name
        if let Some(name) = cli.name.as_deref(){
            println!("name = {name}");
        }

        if let Some(config_path) = cli.config.as_deref(){
            println!("File = {}", config_path.display());
        }

        match cli.debug{
            0=> println!("关闭Debug"),
            1=> println!("开启Debug"),
            2=> println!("Debug"),
            _=> println!("无效Debug模式"),
        }

        match &cli.command{
            Some(Commands::Test{list})=>{
                if *list {
                    println!("打印测试列表...");
                }else{
                    println!("不打印测试列表...");

                }
            },
            None=>{}
        }
     
    }
}

